package com.eastfair.notice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * Im对话列表
 * </p>
 *
 * @author liuxiaobai
 * @since 2021-08-30
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_im_dialog")
@ApiModel(value = "ImDialog", description = "Im对话列表")
@AllArgsConstructor
public class ImDialog extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 项目ID
     */
    @ApiModelProperty(value = "项目ID")
    @NotNull(message = "请填写项目ID")
    @TableField(value = "project_id")
    @Excel(name = "项目ID")
    private Long projectId;

    /**
     * 对话唯一code 规则为对话双方ID升序后拼接
     */
    @ApiModelProperty(value = "对话唯一code 规则为对话双方ID升序后拼接")
    @NotEmpty(message = "请填写对话唯一code 规则为对话双方ID升序后拼接")
    @Size(max = 40, message = "对话唯一code 规则为对话双方ID升序后拼接长度不能超过40")
    @TableField(value = "unique_code", condition = LIKE)
    @Excel(name = "对话唯一code 规则为对话双方ID升序后拼接")
    private String uniqueCode;

    /**
     * 发送人ID
     */
    @ApiModelProperty(value = "发送人ID")
    @NotNull(message = "请填写发送人ID")
    @TableField(value = "from_user_id")
    @Excel(name = "发送人ID")
    private Long fromUserId;

    /**
     * 接收人ID
     */
    @ApiModelProperty(value = "接收人ID")
    @NotNull(message = "请填写接收人ID")
    @TableField(value = "to_user_id")
    @Excel(name = "接收人ID")
    private Long toUserId;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enable")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnable;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_delete")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDelete;


    @Builder
    public ImDialog(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Long projectId, String uniqueCode, Long fromUserId, Long toUserId, Integer isEnable, Integer isDelete) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.projectId = projectId;
        this.uniqueCode = uniqueCode;
        this.fromUserId = fromUserId;
        this.toUserId = toUserId;
        this.isEnable = isEnable;
        this.isDelete = isDelete;
    }

}
